package com.hyz.login.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description TODO
 * @Author 何昱泽大帅逼
 * @Date 2022-07-20 8:45
 **/
public class PageUtil<T> {
    private Integer pageIndex ;//页数索引
    private Integer row = 5;//显示行数
    private Integer totalCount;//总记录数
    private List<T> rowList;//显示内容集合
    private Integer totalPage;//总页数
    private Integer currentPage;//当前页

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageIndex() {
        return (currentPage-1)*row;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getRow() {
        return row;
    }

    public void setRow(Integer row) {
        this.row = row;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public List<T> getRowList() {
        return rowList;
    }

    public void setRowList(List<T> rowList) {
        this.rowList = rowList;
    }

    public Integer getTotalPage() {
        return totalCount%row==0?(totalCount/row):(totalCount/row+1);
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    @Override
    public String toString() {
        return "PageUtil{" +
                "pageIndex=" + pageIndex +
                ", row=" + row +
                ", totalCount=" + totalCount +
                ", rowList=" + rowList +
                ", totalPage=" + totalPage +
                ", currentPage=" + currentPage +
                '}';
    }
}
